<template>
<uni-shadow-root class="partials-richText-richText"><view class="wxParseHtmlContainer" :style="'height: '+(!receiveData.jsonData.height||receiveData.jsonData.height==0?'':receiveData.jsonData.height)+'px'">
    
    <rich-text :nodes="article.nodes"></rich-text>
    
</view></uni-shadow-root>
</template>

<script>

global['__wxRoute'] = 'partials/richText/richText'
const app = getApp();
var WxParse = require('../../wxParse/wxParse.js');
Component({
  properties: {
    receiveData: {
      type: JSON,
      value: 'default value',
    }
  },
  data: {
    someData: {},
    content:'',
  },
  ready:function(){
    var that = this
    var oldData=that.data.receiveData;
    let content=oldData.jsonData?oldData.jsonData.content:oldData;
    WxParse.wxParse('article', 'html', content, that, 10);
    console.log("article",that.data.article,content)
    app.globalData.consoleFun("=====gridist组件-richText=====",[oldData])
    content = content.replace(/<img/gi, '<img style="max-width:100%;height:auto;float:left;display:block" ')
         								 	.replace(/<section/g, '<div')
         									.replace(/\/section>/g, '\div>');
    console.log("content",content);
    that.setData({content:content})
  },
  methods: {
    tolinkUrl: function (event) {
      app.globalData.linkEvent(event.currentTarget.dataset.link);
    }
  },
})
export default global['__wxComponents']['partials/richText/richText']
</script>
<style platform="mp-weixin">
@import "../../wxParse/wxParse.css";
.wxParseHtmlContainer{
    padding: 0 20rpx;
    box-sizing: border-box;
    width: 100%;
}
</style>